#include<bits/stdc++.h>
using namespace std;
#define gc getchar
#define pc putchar
#define pb push_back
#define mp make_pair
#define ls (id<<1)
#define rs ((id<<1)|1)
#define mid ((l+r)>>1)
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)

int read(){
    int ret=0,f=0; char ch=gc();
    while(ch<'0'||ch>'9') f|=(ch=='-'),ch=gc();
    while(ch>='0'&&ch<='9') ret=(ret<<1)+(ret<<3)+(ch^48),ch=gc();
    return f?-ret:ret;
}

void write(int x){
    if(!x) return pc('0'),void();
    if(x<0) pc('-'),x=-x;
    int stk[30],tp=0;
    while(x) stk[++tp]=x%10,x/=10;
    while(tp) pc('0'+stk[tp--]);
    return;
}

const int Maxn=1e6+10;
int N,hed[Maxn],cnt,u,v,fa[Maxn],stk[Maxn];
struct node{int nxt,to;}G[Maxn<<1];
vector<int> Ans;
bool Vis[Maxn];

void Addedge(int x,int y){G[++cnt]=(node){hed[x],y};hed[x]=cnt;}

void DFS(int x,int p){
	fa[x]=p;
	for(int y,i=hed[x];i;i=G[i].nxt){
		if((y=G[i].to)==p) continue;
		DFS(y,x);
	}
}

void Solve(){
	Vis[1]=1; Ans.pb(1);
	For(i,2,N)if(!Vis[i]){
		int x=i,t=0;
		while(!Vis[x]) stk[++t]=x,Vis[x]=1,x=fa[x];
		Rof(j,t,1) Ans.pb(stk[j]);
	}
	For(i,0,N-1) write(Ans[i]),pc(' ');
}

int main(){
    freopen("choice.in","r",stdin);
    freopen("choice.out","w",stdout);
    N=read(); 
    For(i,1,N-1) u=read(),v=read(),Addedge(u,v),Addedge(v,u);
    DFS(1,0); Solve();
    return 0;
}
